package ro.isdc.navigator;

import java.io.Serializable;
import java.util.List;

/**
 * Page class taking part of the pagination abstraction.
 * 
 * @author Andrei Chirila
 */
public class Page<T> implements Serializable {
	
	/**
   * Generated Serialization UID
   */
  private static final long serialVersionUID = 1623756184290428066L;

  /**
	 * The size of the page or the number of results per page.
	 */
	private int pageSize;
	
	/**
	 * The number of the page
	 */
	private int pageNo;
	
	/**
	 * The results contained in the page.
	 */
	private List<T> results;
	
	/**
	 * @return the list of results
	 */
	public List<T> getResults() {
		return results;
	}
	
	/**
	 * @param results the results to set
	 */
	public void setResults(final List<T> results) {
		this.results = results;
	}

	/**
	 * Return the result by index.
	 * 
	 * @param index the index of the result in the page
	 * @return the result indexed in the page by index
	 */
	public T getResult(final int index) {
		return results.get(index);
	}

	/**
	 * @return the pageSize
	 */
	public int getPageSize() {
		return pageSize;
	}

	/**
	 * @param pageSize the pageSize to set
	 */
	public void setPageSize(final int pageSize) {
		this.pageSize = pageSize;
	}

	/**
	 * @return the pageNo
	 */
	public int getPageNo() {
		return pageNo;
	}

	/**
	 * @param pageNo the pageNo to set
	 */
	public void setPageNo(final int pageNo) {
		this.pageNo = pageNo;
	}
	
}
